'use strict';

module.exports =createUpdatedCollection;
function createUpdatedCollection(collectionA, objectB) {
  let result=[];
  let arr=objectB.value;
  let obj={};

  for(let i=0;i<collectionA.length;i++){
    for(let j of arr){
      if(collectionA[i].key===j){
        collectionA[i].count--;
      }
    }
  }
   
result.push(collectionA);
  console.log(result[0]);
  return result[0];
}
createUpdatedCollection([
  {key: 'a', count: 2},
  {key: 'e', count: 2},
  {key: 'h', count: 2},
  {key: 't', count: 2},
  {key: 'f', count: 2},
  {key: 'c', count: 2},
  {key: 'g', count: 2},
  {key: 'b', count: 2},
  {key: 'd', count: 2}
], {value: ['a', 'd', 'e', 'f']}
);